# 就餐人数
# 在为完成练习9-1而编写的程序中，添加一个名为number_served的属性，并将其默认值设置为0。根据这个类创建一个名为restaurant 的实例。打印有多少人在家餐馆就餐过，然后修改这个值并再次打印它
# 添加一个名为set_number_served() 的方法，让你能够设置就餐人数。调用这个方法并向它传递一个值，然后再次打印这个值
# 添加一个名为increment_number_served() 的方法，让你能够将就餐人数递增。调用这个s方法并向它传递一个这样的值：你认为这家餐馆每天可能接待的就餐人数

class Restaurant:
    def __init__(self, restaurant_name, cuisine_type):
        self.restaurant_name = restaurant_name
        self.cuisine_type = cuisine_type
        self.number_served = 0

    def describe_restaurant(self):
        print(f"Restaurant's name is {self.restaurant_name}.")
        print(f"Restaurant's cuisine_type is {self.cuisine_type}.")

    def open_restaurant(self):
        print(f"{self.restaurant_name} is opening.")

    def set_number_served(self, number_served):
        if number_served < 0 or number_served < self.number_served:
            print("Illegal operation.")
        else:
            self.number_served = number_served

    def increment_number_served(self, step):
        if step < 0:
            print("Illegal operation")
        else:
            self.number_served += step


restaurant = Restaurant('超意兴', '快餐')
print(
    f"{restaurant.restaurant_name} served {restaurant.number_served} customers.")
restaurant.number_served = 10
print(
    f"{restaurant.restaurant_name} served {restaurant.number_served} customers.")
restaurant.set_number_served(20)
print(
    f"{restaurant.restaurant_name} served {restaurant.number_served} customers.")
restaurant.increment_number_served(5)
print(
    f"{restaurant.restaurant_name} served {restaurant.number_served} customers.")
